package com.xy_pro.xymanager.repository;

import com.xy_pro.xymanager.entity.UserEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Collection;
import java.util.Optional;

public interface UserRepository extends JpaRepository<UserEntity, Long> {
    Optional<UserEntity> findByName(String name);
    Boolean existsUserByName(String name);
    Boolean existsUserByPhone(String phone);

    Page<UserEntity> findAllByNameContaining(String name, Pageable pageable);
    Collection<UserEntity> findByRole(UserEntity.Role role);
}
